# -*- coding: utf-8 -*-

from django.db import models


class Comment(models.Model):
    """评论"""
    name = models.CharField(verbose_name=u'评论用户的名称', max_length=100)
    email = models.EmailField(verbose_name=u'邮箱', max_length=255)
    url = models.URLField(verbose_name=u'个人网址', max_length=200, blank=True)
    text = models.TextField(verbose_name=u'评论内容')
    created_time = models.DateTimeField(verbose_name=u'评论时间', auto_now_add=True)
    article = models.ForeignKey('myblog.Article')

    class Meta:
        db_table = 'mb_comment'
        verbose_name = u'评论'
        verbose_name_plural = u'评论'

    def __unicode__(self):
        return self.text[:20]
